package zzg.study.server.handler;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import zzg.study.protocol.request.HeartBeatRequestPacket;
import zzg.study.protocol.response.HeartBeatResponsePacket;

/**
 * @Classname HeartBeatRequestHandler
 * @Description 心跳检测
 * @Date 2023/11/30 21:12
 * @Author zhuzhenguo
 */
@ChannelHandler.Sharable
public class HeartBeatRequestHandler extends SimpleChannelInboundHandler<HeartBeatRequestPacket> {

    public static final HeartBeatRequestHandler INSTANCE = new HeartBeatRequestHandler();

    private HeartBeatRequestHandler() {

    }

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, HeartBeatRequestPacket requestPacket) {
        ctx.writeAndFlush(new HeartBeatResponsePacket());
    }
}
